package com.whut.controller;

import com.whut.service.SampleEquipService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.ArrayList;

@Controller
@RequestMapping("/sample")
public class SampleEquipController {
    @Resource
    private SampleEquipService SampleEquipService;

    @ResponseBody
    @PostMapping("/getSampleByProjectId")
    public ArrayList getAllSampleByProject(Integer projectId,Integer taskId) {
        return SampleEquipService.getSampleByProjectId(projectId,taskId);
    }

    @ResponseBody
    @PostMapping("/changeSampleTypeByMkey")
    public int changeSampleTypeByMkey(Integer mKey, Integer sampleType) {
        return SampleEquipService.changeSampleType(mKey, sampleType);
    }

    @ResponseBody
    @PostMapping("/modifySuggestNum")
    public int changeSampleTypeByMkey(Integer mKey, Integer rangeNum1, Integer rangeNum2, Integer rangeNum3) {
        return SampleEquipService.changeNum(mKey, rangeNum1, rangeNum2, rangeNum3);
    }

    @ResponseBody
    @PostMapping("/getAllEquipment")
    public ArrayList getAllEquipment(Integer projectId) {
        return SampleEquipService.getAllEquipment(projectId);
    }

    //只查找使用中的设备，equipState==2
    @ResponseBody
        @PostMapping("/getDutyEquipByProject")
        public ArrayList getDutyEquipByProject(Integer projectId) {
            return SampleEquipService.getDutyEquipByProject(projectId);
        }

    @ResponseBody
    @PostMapping("/saveSampleDetail")
    public int saveSampleDetail(Integer mKey, String sampleNum, String originSampleIndex,String sampleIndex, String sampleUnit,String modifyReason) {
        return SampleEquipService.saveSampleDetail(mKey, sampleNum, originSampleIndex,sampleIndex, sampleUnit,modifyReason);
    }


}
